package com.witmed.lib_base

import android.app.Application
import android.content.Context
import com.alibaba.android.arouter.launcher.ARouter

import com.tencent.mmkv.MMKV
//import com.witmed.mymdm.delegate.MyAppRequestListener
//import com.witmed.mymdm.delegate.MyComponentDelegate
//import com.witmed.mymdm.delegate.MyPhoneInfoDelegate
//import com.witmed.mymdm.delegate.MyTaskDescriptionDelegate
//import com.lody.virtual.client.core.VirtualCore
//import com.lody.virtual.client.core.VirtualCore.VirtualInitializer
//import com.lody.virtual.client.stub.VASettings


class App:Application() {

    companion object{
        lateinit var baseApplication : App
        fun getContext():Context{
            return baseApplication
        }
    }





    override fun onCreate() {
        super.onCreate()
        baseApplication = this


        MMKV.initialize(this)

        ARouter.openDebug()
        ARouter.openLog()
        ARouter.init(this)

        /*val virtualCore = VirtualCore.get()
        virtualCore.initialize(object : VirtualInitializer() {
            override fun onMainProcess() {
//                Once.initialise(this@App)
//                Builder()
//                    .withLogEnabled(true)
//                    .withListener {}
//                    .build(this@VApp, "48RJJP7ZCZZBB6KMMWW5")
            }

            override fun onVirtualProcess() {
                //listener components
                virtualCore.componentDelegate = MyComponentDelegate()
                //fake phone imei,macAddress,BluetoothAddress
                virtualCore.phoneInfoDelegate = MyPhoneInfoDelegate()
                //fake task description's icon and title
                virtualCore.taskDescriptionDelegate = MyTaskDescriptionDelegate()
            }

            override fun onServerProcess() {
                virtualCore.setAppRequestListener(MyAppRequestListener(this@App))
                virtualCore.addVisibleOutsidePackage("com.tencent.mobileqq")
                virtualCore.addVisibleOutsidePackage("com.tencent.mobileqqi")
                virtualCore.addVisibleOutsidePackage("com.tencent.minihd.qq")
                virtualCore.addVisibleOutsidePackage("com.tencent.qqlite")
                virtualCore.addVisibleOutsidePackage("com.facebook.katana")
                virtualCore.addVisibleOutsidePackage("com.whatsapp")
                virtualCore.addVisibleOutsidePackage("com.tencent.mm")
                virtualCore.addVisibleOutsidePackage("com.immomo.momo")
            }
        })*/
    }

    /*override fun attachBaseContext(base: Context) {
        super.attachBaseContext(base)
        VASettings.ENABLE_IO_REDIRECT = true
        VASettings.ENABLE_INNER_SHORTCUT = false
        try {
            VirtualCore.get().startup(base)
        } catch (e: Throwable) {
            e.printStackTrace()
        }
    }*/
}